package com.weiadmin.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.weiadmin.common.PageParam;
import com.weiadmin.model.system.SlideItemModel;
import com.weiadmin.model.system.SlideModel;

public interface SlideItemDao extends MPJBaseMapper<SlideItemModel> {

    default Page<SlideItemModel> getList(PageParam pageParam){

        Page<SlideItemModel> pager = new Page<>(pageParam.getPage(), pageParam.getLimit());
        MPJLambdaWrapper<SlideItemModel> queryWrapper = new MPJLambdaWrapper<SlideItemModel>()
                .selectAll(SlideItemModel.class)
                .selectAs(SlideModel::getName,"categoryName")
                .leftJoin(SlideModel.class,SlideModel::getId,SlideItemModel::getSlideId)
                ;

//        queryWrapper.orderByDesc("id");
        return selectPage(pager, queryWrapper);
    }
}
